import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JButton;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import javax.swing.JLabel;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;


public class Interface extends JFrame {

	private JPanel contentPane;
	private JTextField txtTentativa;
	private JRadioButton rdbtnNo;
	private JRadioButton rdbtnSim;
	private JButton btnGerar;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					Interface frame = new Interface();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public Interface() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 230, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		btnGerar = new JButton("Gerar");
		btnGerar.addActionListener(new ActionListener() {
			
			public void actionPerformed(ActionEvent arg0) {
				MontyHall.setTentativa(Integer.valueOf(txtTentativa.getText()));
				MontyHall.porcentagem();
				txtTentativa.setText(String.valueOf(MontyHall.getResultadoDeGanho()));
			}
		});
		btnGerar.setBounds(51, 204, 91, 23);
		contentPane.add(btnGerar);
		
		rdbtnSim = new JRadioButton("Sim");
		rdbtnSim.setBounds(39, 148, 49, 23);
		contentPane.add(rdbtnSim);
		
		rdbtnNo = new JRadioButton("N\u00E3o");
		rdbtnNo.setBounds(101, 148, 49, 23);
		contentPane.add(rdbtnNo);
		
		txtTentativa = new JTextField();
		txtTentativa.setBounds(24, 64, 164, 20);
		contentPane.add(txtTentativa);
		txtTentativa.setColumns(10);
		
		JLabel lblQuantasVezesVoc = new JLabel("Quantas vezes voc\u00EA quer repitir??");
		lblQuantasVezesVoc.setBounds(24, 23, 164, 14);
		contentPane.add(lblQuantasVezesVoc);
		
		JLabel lblQuerTrocarDe = new JLabel("Quer trocar de escolha??");
		lblQuerTrocarDe.setBounds(39, 116, 120, 14);
		contentPane.add(lblQuerTrocarDe);
	}
}
